public class Main {
    public static void main(String[] args) {
        // 创建新型农机设备
        NewMachineInterface newMachine = new ModernSensorDevice();

        // 使用适配器将新设备转换为旧接口
        OldMachineInterface adaptedMachine = new NewMachineAdapter(newMachine);

        // 通过旧接口使用新设备
        System.out.println("传感器数据: " + adaptedMachine.getSensorData());
        adaptedMachine.startEngine();
        System.out.println(adaptedMachine.getStatus());
        OldMachineInterface baseMachine = new Tractor();

        // 使用日志装饰器包装基础农机
        OldMachineInterface loggedMachine = new LoggingDecorator(baseMachine);

        // 使用性能监控装饰器包装带日志的农机
        OldMachineInterface monitoredMachine = new PerformanceMonitorDecorator(loggedMachine);

        // 调用扩展后的功能
        System.out.println("传感器数据: " + monitoredMachine.getSensorData());
        monitoredMachine.startEngine();
        System.out.println("设备状态: " + monitoredMachine.getStatus());
    }
}